home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
DATAPLOT.LI3
< prev
next >
Wrap
Text File
|
1993-12-23
|
779b
|
33 lines
# dataplot() plots data ( [x1,x2,...], [y1,y2,...] ) on xy-plane
# e.g. dataplot([1,2,3], [1,4,9])
dataplot(x_, y_) := block(numeric:=on,
graph,
xmax:=max(x),
xmin:=min(x),
ymax:=max(y),
ymin:=min(y),
getmaxy3:=getmaxy-30,
getmaxy2:=getmaxy3+1,
dx:=(xmax-xmin)/(getmaxx-40),
dy:=(ymax-ymin)/(getmaxy-30),
length:=length(y),
line(40,getmaxy3,getmaxx,getmaxy3),
line(40,0,40,getmaxy3),
moveto(0,0),
writes(ymax),
moveto(0,getmaxy3),
writes(ymin),
moveto(35,getmaxy-20),
writes(xmin),
moveto(getmaxx-30,getmaxy-20),
writes(xmax),
setviewport(40,0,getmaxx,getmaxy3,1),
moveto(0,getmaxy3),
do( lineto((member(x,j)-xmin)/dx,getmaxy2-(member(y,j)-ymin)/dy),
j,1,length,1),
numeric:=off,
readchar,
text,
local(dx,dy,length))